#!/bin/bash
echo "awk格式为:awk [选项] '条件{命令} 条件{命令} 条件{命令}',只能是单引号"
echo 'free | awk "NR!={print $2}的结果"'
free | awk 'NR!=1{print $2}'
echo "内置变量使用"
awk 'NR==1{print "当前文件名称:"FILENAME} {print "当前行号:"NR} {print "当前行号字段:"NF"个"}' basic.txt
echo "使用系统环境变量:echo ''|awk '{print \"'\$USER'\"}'"
echo ''|awk '{print "'$USER'"}'
